import * as bcrypt from 'bcrypt';
const saltRounds = 10;

export function hashPassword(password: string): Promise<string> {
    return bcrypt.hash(password, saltRounds);
}

/**
 * compare password
 * @param password plain password
 * @param hash hash
 */
export function comparePassword(password: string, hash: string): Promise<boolean> {
    return bcrypt.compare(password, hash);
}
